package app.netant.galgame.hgamecn;

import org.jsoup.select.Elements;

import app.netant.NetAntBase;

import org.jsoup.nodes.Element;

import cn.lily.com.lang.Basic;


/**
 * Hgamecn 采集类
 * @author JiaJ
 * @date 2018年6月13日
 *
 */
public class HgamecnAntDetail extends NetAntBase {

	public HgamecnAntDetail(String netSite) {
		super(netSite);
	}
	
	private String memo = "";
	
	public String getMemo(){
		
		Elements activePart = document.select(".container-fluid #content .row-fluid .block .block-content.collapse.in");
		Element memoPart = activePart.get(2);
		
		if(memoPart.select("blockquote") != null){
			this.memo = this.getString(memoPart.select("blockquote").html());
		}
		
		return this.memo;
	}
	
	public void analyseTags(HgamecnEntity entity){
		Elements activePart = document.select(".container-fluid #content .row-fluid .block .block-content.collapse.in");
		Element tagPart = activePart.get(0);	
		Elements tagEls = tagPart.select(".media .media-body.control-group .control-group .tags");
		
		for(int i=0;i<tagEls.size();i++){
			String tagActive = this.getString(tagEls.get(i).text());
			String[] tags = Basic.split(tagActive, ":","：");
			
			if(tags.length == 2){
				entity.setTag(tags[0], this.getString(tags[1]));
			}
		}
			
		
	}
	
	
	
	public static void main(String[] args) {
		HgamecnAntDetail detail = new HgamecnAntDetail("https://www.2dfan.com/subjects/7691");
		detail.getMemo();
	}
	
}
